package org.belkodevelop.controller;

import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class MainPagesController {

    private final Log log = LogFactory.getLog(getClass());

    @RequestMapping(value = {"/", "", "index.html"})
    public String index() {
        return "main";
    }
    
    @RequestMapping("/listings.html")
    public ModelAndView listing(@RequestParam(required = false) String findRequest) {
        ModelAndView modelAndView = new ModelAndView("listings");
        modelAndView.addObject("findRequest", StringEscapeUtils.escapeJavaScript(findRequest));
        return modelAndView ;
    }   
    
    @RequestMapping("/terms.html")
    public String terms() {
        return "terms";
    }  
    
    @RequestMapping("/contact.html")
    public String contact() {
        return "contact";
    }
    
    @RequestMapping("/about.html")
    public String about() {
        return "about";
    }
    
    @RequestMapping("/test.html")
    public String test() {
        return "test";
    }
}
